<!--
 * @Author: YuA
 * @Date: 2021-08-07 20:49:19
 * @LastEditTime: 2021-08-21 10:01:10
 * @FilePath: \index\src\components\content\tabControl\TabControl.vue
-->
<template>
  <div class="tabControl" :class="songClass">
    <div
      v-for="(item, index) in title"
      :key="index"
      class="tabCont-item"
      @click="active(index)"
    >
      <span :class="{ color: index == count }" class="iconfont">{{
        item
      }}</span>
    </div>
  </div>
</template>

<script>
export default {
  name: "TabControl",
  props: {
    title: {
      type: Array,
      default() {
        return [];
      }
    },
    songClass: {
      type: String,
      default() {
        return "";
      }
    }
  },
  data() {
    return {
      count: 0
    };
  },
  methods: {
    active(index) {
      this.count = index;
      this.$emit("tabClick", index);
    }
  }
};
</script>

<style lang="scss" scoped>
.tabControl {
  display: flex;
  width: 120%;

  color: #e7e5e1;
}
.tabCont-item {
  span {
    padding: 0 5px;
    font-size: 23px;
    transition: all 0.3s linear;
  }
}
.color {
  color: #fff;
}
</style>
